import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useUserStore = defineStore('user', () => {
  const userInfo = ref({
    name: '',
    role: '',
    id: ''
  })

  function setUserInfo(info: typeof userInfo.value) {
    userInfo.value = info
  }

  return { userInfo, setUserInfo }
}, {
  persist: true // 开启持久化
})